package com.ckfinder.connector.handlers.command;
import java.io.File;
import java.util.regex.Pattern;
import javax.servlet.http.HttpServletRequest;
import org.w3c.dom.Element;
import com.ckfinder.connector.configuration.Constants;
import com.ckfinder.connector.configuration.IConfiguration;
import com.ckfinder.connector.errors.ConnectorException;
import com.ckfinder.connector.utils.FileUtils;
import com.ckfinder.connector.utils.PathUtils;
public class XMLErrorCommand extends XMLCommand {
    private ConnectorException connectorException;
    @Override
    public void initParams(final HttpServletRequest request,
                           final IConfiguration configuration, final Object... params)
            throws ConnectorException {
        super.initParams(request, configuration, params);
        this.connectorException = (ConnectorException) params[0];
        if (connectorException.isAddCurrentFolder()) {
            this.type = getParameter(request, "type");
        }
    }
    @Override
    protected int getDataForXml() {
        return connectorException.getErrorCode();
    }
    @Override
    protected void createXMLChildNodes(final int errorNum,
                                       final Element rootElement) throws ConnectorException {
    }
    @Override
    protected String getErrorMsg(final int errorNum) {
        return connectorException.getErrorMessage();
    }
    @Override
    protected boolean checkParam(final String reqParam)
            throws ConnectorException {
        if (reqParam == null || reqParam.equals("")) {
            return true;
        }
        if (Pattern.compile(Constants.INVALID_PATH_REGEX).matcher(reqParam).find()) {
            return false;
        }
        return true;
    }
    @Override
    protected boolean checkConnector(final HttpServletRequest request)
            throws ConnectorException {
        if (!configuration.enabled() || !configuration.checkAuthentication(request)) {
            this.connectorException = new ConnectorException(
                    Constants.Errors.CKFINDER_CONNECTOR_ERROR_CONNECTOR_DISABLED);
            return false;
        }
        return true;
    }
    @Override
    protected boolean checkHidden()
            throws ConnectorException {
        if (FileUtils.checkIfDirIsHidden(this.currentFolder, configuration)) {
            this.connectorException = new ConnectorException(
                    Constants.Errors.CKFINDER_CONNECTOR_ERROR_CONNECTOR_DISABLED);
            return true;
        }
        return false;
    }
    @Override
    protected boolean checkIfCurrFolderExists(final HttpServletRequest request)
            throws ConnectorException {
        String tmpType = getParameter(request, "type");
        File currDir = new File(configuration.getTypes().get(tmpType).getPath()
                + this.currentFolder);
        if (currDir.exists() && currDir.isDirectory()) {
            return true;
        } else {
            this.connectorException = new ConnectorException(
                    Constants.Errors.CKFINDER_CONNECTOR_ERROR_FOLDER_NOT_FOUND);
            return false;
        }
    }
    @Override
    protected boolean mustAddCurrentFolderNode() {
        return connectorException.isAddCurrentFolder();
    }
    @Override
    protected void getCurrentFolderParam(final HttpServletRequest request) {
        String currFolder = getParameter(request, "currentFolder");
        if (!(currFolder == null || currFolder.equals(""))) {
            this.currentFolder = PathUtils.addSlashToBeginning(PathUtils.addSlashToEnd(currFolder));
        }
    }
}
package com.itheima.elec.webservice
public  class FindSystemByKeywordResponse
        implements org.apache.axis2.databinding.ADBBean{
    public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName(
            "http://webservice.elec.itheima.com","findSystemByKeywordResponse","ns2");
    protected com.itheima.elec.domain.xsd.ElecSystemDDL[] local_return ;
    protected boolean local_returnTracker = false ;
    public boolean is_returnSpecified(){
        return local_returnTracker;
    }
    public  com.itheima.elec.domain.xsd.ElecSystemDDL[] get_return(){
        return local_return;
    }
    protected void validate_return(com.itheima.elec.domain.xsd.ElecSystemDDL[] param){
    }
    public void set_return(com.itheima.elec.domain.xsd.ElecSystemDDL[] param){
        validate_return(param);
        local_returnTracker = true;
        this.local_return=param;
    }
    public void add_return(com.itheima.elec.domain.xsd.ElecSystemDDL param){
        if (local_return == null){
            local_return=newcom.itheima.elec.domain.xsd.ElecSystemDDL[]{};
        }
        //update the setting tracker
        local_returnTracker = true;
        java.util.Listlist=                       org.apache.axis2.databinding.utils.ConverterUtil.toList(local_return);
        list.add(param);
        this.local_return =(com.itheima.elec.domain.xsd.ElecSystemDDL[])list.toArray(new com.itheima.elec.domain.xsd.ElecSystemDDL[list.size()]);
    }
    public org.apache.axiom.om.OMElement getOMElement (
            final javax.xml.namespace.QName parentQName,
            finalorg.apache.axiom.om.OMFactoryfactory)throws org.apache.axis2.databinding.ADBException{
        org.apache.axiom.om.OMDataSource dataSource =
                new org.apache.axis2.databinding.ADBDataSource(this,MY_QNAME);
        return factory.createOMElement(dataSource,MY_QNAME);
    }
    public void serialize(final javax.xml.namespace.QName parentQName,
                          javax.xml.stream.XMLStreamWriter xmlWriter)
            throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{
        serialize(parentQName,xmlWriter,false);
    }
    public void serialize(final javax.xml.namespace.QName parentQName,
                          javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType)
            throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{
        java.lang.String prefix = null;
        java.lang.String namespace = null;
        prefix = parentQName.getPrefix();
        namespace = parentQName.getNamespaceURI();
        writeStartElement(prefix, namespace, parentQName.getLocalPart(), xmlWriter);
        if(serializeType){java.lang.String	namespacePrefix= registerPrefix(xmlWriter,"http://webservice.elec.itheima.com");
            if ((namespacePrefix != null) && (namespacePrefix.trim().length()> 0)){
                writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type",
                        namespacePrefix+":findSystemByKeywordResponse",xmlWriter);
            } else {
                writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type","findSystemByKeywordResponse", xmlWriter);
            }
        }
        if (local_returnTracker){
            if (local_return!=null){
                for (int i = 0;i < local_return.length;i++){
                    if (local_return[i] != null){
                        local_return[i].serialize(new javax.xml.namespace.QName("http://webservice.elec.itheima.com","return"),
                                xmlWriter);
                    } else {
                        writeStartElement(null, "http://webservice.elec.itheima.com", "return", xmlWriter);
                        writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter);
                        xmlWriter.writeEndElement();
                    }
                }
            }else{                                                    writeStartElement(null,"http://webservice.elec.itheima.com","return",xmlWriter);                                                                               writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter);
                xmlWriter.writeEndElement();
            }
        }
        xmlWriter.writeEndElement();
        private static java.lang.String generatePrefix(java.lang.String namespace) {
            if(namespace.equals("http://webservice.elec.itheima.com")){
                return "ns2";
            }
            return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
        }
        private void writeStartElement(java.lang.String prefix, java.lang.String namespace, java.lang.String localPart, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
            java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
            if (writerPrefix != null) {
                xmlWriter.writeStartElement(namespace, localPart);
            } else {
                if (namespace.length() == 0) {
                    prefix = "";
                } else if (prefix == null) {
                    prefix = generatePrefix(namespace);
                }
                xmlWriter.writeStartElement(prefix, localPart, namespace);
                xmlWriter.writeNamespace(prefix, namespace);
                xmlWriter.setPrefix(prefix, namespace);
            }
        }
        Private void	writeAttribute(java.lang.String	prefix,java.lang.String namespace,java.lang.String attName,
                java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
            if (xmlWriter.getPrefix(namespace) == null) {
                xmlWriter.writeNamespace(prefix, namespace);
                xmlWriter.setPrefix(prefix, namespace);
            }
            xmlWriter.writeAttribute(namespace,attName,attValue);
        }
        private void writeAttribute(java.lang.String namespace,java.lang.String attName,
                java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
            if (namespace.equals("")) {
                xmlWriter.writeAttribute(attName,attValue);
            } else {
                registerPrefix(xmlWriter, namespace);
                xmlWriter.writeAttribute(namespace,attName,attValue);
            }
        }
        private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName,
                avax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
            java.lang.String attributeNamespace = qname.getNamespaceURI();
            java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
            if (attributePrefix == null) {
                attributePrefix = registerPrefix(xmlWriter, attributeNamespace);
            }
            java.lang.String attributeValue;
            if (attributePrefix.trim().length() > 0) {
                attributeValue = attributePrefix + ":" + qname.getLocalPart();
            } else {
                attributeValue = qname.getLocalPart();
            }
            if (namespace.equals("")) {
                xmlWriter.writeAttribute(attName, attributeValue);
            } else {
                registerPrefix(xmlWriter, namespace);
                xmlWriter.writeAttribute(namespace, attName, attributeValue);
            }
        }
        private void writeQName(javax.xml.namespace.QName qname,
                javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
            java.lang.String namespaceURI = qname.getNamespaceURI();
            if (namespaceURI != null) {
                java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
                if (prefix == null) {
                    prefix = generatePrefix(namespaceURI);
                    xmlWriter.writeNamespace(prefix, namespaceURI);
                    xmlWriter.setPrefix(prefix,namespaceURI);
                }              if(prefix.trim().length() >0){ xmlWriter.writeCharacters(prefix+":"+org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
                } else {
                    xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
                }
            }else{  、xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
            }
        }
        private void writeQNames(javax.xml.namespace.QName[] qnames,
                javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
            if (qnames != null) {
                java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer();
                java.lang.String namespaceURI = null;
                java.lang.String prefix = null;
                for (int i = 0; i < qnames.length; i++) {
                    if (i > 0) {
                        stringToWrite.append(" ");
                    }
                    namespaceURI = qnames[i].getNamespaceURI();
                    if (namespaceURI != null) {
                        prefix = xmlWriter.getPrefix(namespaceURI);
                        if ((prefix == null) || (prefix.length() == 0)) {
                            prefix = generatePrefix(namespaceURI);
                            xmlWriter.writeNamespace(prefix, namespaceURI);
                            xmlWriter.setPrefix(prefix,namespaceURI);
                        }
                        if(prefix.trim().length() >0){  stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
                        }else{     stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
                        }
                    }else{stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
                    }
                }
                xmlWriter.writeCharacters(stringToWrite.toString());
            }
            private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException {
                java.lang.String prefix = xmlWriter.getPrefix(namespace);
                if (prefix == null) {
                    prefix = generatePrefix(namespace);
                    javax.xml.namespace.NamespaceContext	nsContext=xmlWriter.getNamespaceContext();
                    while (true) {
                        java.lang.String uri = nsContext.getNamespaceURI(prefix);
                        if (uri == null || uri.length() == 0) {
                            break;
                        }
                        prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
                    }
                    xmlWriter.writeNamespace(prefix, namespace);
                    xmlWriter.setPrefix(prefix, namespace);
                }
                return prefix;
            }
            public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)
       throws org.apache.axis2.databinding.ADBException{
                java.util.ArrayList elementList = new java.util.ArrayList();
                java.util.ArrayList attribList = new java.util.ArrayList();
                if (local_returnTracker){
                    if (local_return!=null) {
                        for (int i = 0;i < local_return.length;i++){
                            if (local_return[i] != null){
                                elementList.add(new javax.xml.namespace.QName("http://webservice.elec.itheima.com", "return"));
                                elementList.add(local_return[i]);
                            } else {
                                elementList.add(new javax.xml.namespace.QName("http://webservice.elec.itheima.com",
                                        "return"));
                                elementList.add(null);
                            }
                        }
                    }else{elementList.add(newjavax.xml.namespace.QName("http://webservice.elec.itheima.com",   "return")); elementList.add(local_return);
                    }
                }
                Return	 new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());
            }
            public static class Factory{
                public static FindSystemByKeywordResponse parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{
                    FindSystemByKeywordResponse object =new FindSystemByKeywordResponse();
                    int event;
                    java.lang.String nillableValue = null;
                    java.lang.String prefix ="";
                    java.lang.String namespaceuri ="";
                    try {
                        while (!reader.isStartElement() && !reader.isEndElement())
                            reader.next();
                        if(reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){
                            java.lang.String	fullTypeName=reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
                                    "type");
                            if (fullTypeName!=null){
                                java.lang.String nsPrefix = null;
                                if (fullTypeName.indexOf(":") > -1){
                                    nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":"));
                                }
                                nsPrefix = nsPrefix==null?"":nsPrefix;
                                java.lang.String	type=fullTypeName.substring(fullTypeName.indexOf(":")+1);
                                if (!"findSystemByKeywordResponse".equals(type)){
                                    //find namespace for the prefix
                                    java.lang.String	 nsUri=reader.getNamespaceContext().getNamespaceURI(nsPrefix);
                                    return (FindSystemByKeywordResponse)com.itheima.elec.webservice.ExtensionMapper.getTypeObject(
                                            nsUri,type,reader);
                                }
                            }
                        }
                        java.util.Vector handledAttributes = new java.util.Vector();
                        reader.next();
                        java.util.ArrayList list1 = new java.util.ArrayList();
                        while (!reader.isStartElement() && !reader.isEndElement()) reader.next();
                        if(reader.isStartElement()&&newjavax.xml.namespace.QName("http://webservice.elec.itheima.com","return").equals(reader.getName())){
                            nillableValue=reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil");
                            if ("true".equals(nillableValue) || "1".equals(nillableValue)){
                                list1.add(null);
                                reader.next();
                            }else{
                                list1.add(com.itheima.elec.domain.xsd.ElecSystemDDL.Factory.parse(reader));               }                                                                                                          boolean loopDone1 = false;
                            while(!loopDone1){  while (!reader.isEndElement())
                                reader.next();                                                                                                                        reader.next();                                                                                                       while (!reader.isStartElement() && !reader.isEndElement())
                                reader.next();
                                if(reader.isEndElement()){    loopDone1 = true;
                                } else {
                                    if(newjavax.xml.namespace.QName("http://webservice.elec.itheima.com","return").equals(reader.getName())){
                                        nillableValue=reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil");if ("true".equals(nillableValue) || "1".equals(nillableValue)){
                                            list1.add(null);                                                                          reader.next();
                                        }else{ list1.add(com.itheima.elec.domain.xsd.ElecSystemDDL.Factory.parse(reader));
                                        }
                                    }else{
                                        loopDone1 = true;
                                    }
                                }
                            }
                            object.set_return((com.itheima.elec.domain.xsd.ElecSystemDDL[])                                                            org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(                         com.itheima.elec.domain.xsd.ElecSystemDDL.class,                                                            list1));
                        }
// End of if for expected property start element
                        else {
                            while (!reader.isStartElement() && !reader.isEndElement())
                                reader.next();
                            if (reader.isStartElement())
 / /A start element we are not expecting indicates a trailing invalid property
                            thrownew org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getName());
                        } catch (javax.xml.stream.XMLStreamException e) {
                            throw new java.lang.Exception(e);
                        }
                        return object;
                    }
                }
            }
 package com.itheima.elec.webservice;
            public	class	IWebSystemDDLServiceMessageReceiverInOut	extends org.apache.axis2.receivers.AbstractInOutMessageReceiver{
                public void invokeBusinessLogic(org.apache.axis2.context.MessageContext msgContext, org.apache.axis2.context.MessageContext newMsgContext)
                        throws org.apache.axis2.AxisFault{
                    try {
                        // get the implementation class for the Web Service
                        Object obj = getTheImplementationObject(msgContext);
                        IWebSystemDDLServiceSkeleton skel = (IWebSystemDDLServiceSkeleton)obj;
                        //Out Envelop
                        org.apache.axiom.soap.SOAPEnvelope envelope = null;
                        //Find the axisOperation that has been set by the Dispatch phase.
                        org.apache.axis2.description.AxisOperation	op= msgContext.getOperationContext().getAxisOperation();
                        if (op == null) {
                            throw new org.apache.axis2.AxisFault("Operation is not located, if this is doclit style the SOAP-ACTION should specified via the SOAP Action to use the RawXMLProvider");
                        }
                        java.lang.String methodName;
                        if((op.getName()!=null)&&((methodName= org.apache.axis2.util.JavaUtils.xmlNameToJavaIdentifier(op.getName().getLocalPart())) != null)){
                            if("findSystemByKeyword".equals(methodName)){
                                com.itheima.elec.webservice.FindSystemByKeywordResponse findSystemByKeywordResponse1 = null;
                                com.itheima.elec.webservice.FindSystemByKeyword	wrappedParam=                                                            (com.itheima.elec.webservice.FindSystemByKeyword)fromOM(                                    msgCont
                                        ext.getEnvelope().getBody().getFirstElement(),                                    com.itheima.elec.webservice.FindSystemByKeyword.class,
                                        getEnvelopeNamespaces(msgContext.getEnvelope()));
                                findSystemByKeywordResponse1 =skel.findSystemByKeyword(wrappedParam);
                                envelope = toEnvelope(getSOAPFactory(msgContext), findSystemByKeywordResponse1, false, new
                                        javax.xml.namespace.QName("http://webservice.elec.itheima.com",
                                        "findSystemByKeyword"));
                            } else {
                                throw new java.lang.RuntimeException("method not found");
                            }
                            newMsgContext.setEnvelope(envelope);
                        }
                    }
                    catch (java.lang.Exception e) {
                        throw org.apache.axis2.AxisFault.makeFault(e);
                    }
                }
                Private	org.apache.axiom.om.OMElement toOM(com.itheima.elec.webservice.FindSystemByKeyword param, boolean optimizeContent)
                        throws org.apache.axis2.AxisFault {
                    try{
                        return param.getOMElement(com.itheima.elec.webservice.FindSystemByKeyword.MY_QNAME,                                         org.apache.axiom.om.OMAbstractFactory.getOMFactory());
                    } catch(org.apache.axis2.databinding.ADBException e){
                        throw org.apache.axis2.AxisFault.makeFault(e);
                    }
                }
                Private	org.apache.axiom.om.OMElement
                toOM(com.itheima.elec.webservice.FindSystemByKeywordResponse	param,boolean optimizeContent)
                        throws org.apache.axis2.AxisFault {
                    try{
                        return param.getOMElement(com.itheima.elec.webservice.FindSystemByKeywordResponse.MY_QNAME,                                          org.apache.axiom.om.OMAbstractFactory.getOMFactory());
                    } catch(org.apache.axis2.databinding.ADBException e){
                        throw org.apache.axis2.AxisFault.makeFault(e);
                    }
                }
                Private	org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, com.itheima.elec.webservice.FindSystemByKeywordResponse param, boolean optimizeContent,
                                                                         javax.xml.namespace.QName methodQName)
                        throws org.apache.axis2.AxisFault{
                    try{
                        org.apache.axiom.soap.SOAPEnvelope	emptyEnvelope=factory.getDefaultEnvelope();                                                              emptyEnvelope.getBody().addChild(param.getOMElement(com.itheima.elec.webservice.FindSystemByKeywordResponse.MY_QNAME,factory));
                        return emptyEnvelope;
                    } catch(org.apache.axis2.databinding.ADBException e){
                        throw org.apache.axis2.AxisFault.makeFault(e);
                    }
                }
private com.itheima.elec.webservice.FindSystemByKeywordResponsewrapfindSystemByKeyword() com.itheima.elec.webservice.FindSystemByKeywordResponse	wrappedElement=new com.itheima.elec.webservice.FindSystemByKeywordResponse();
                                return wrappedElement;
            }
            private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory){
                return factory.getDefaultEnvelope();
            }
            private  java.lang.Object fromOM(
                    org.apache.axiom.om.OMElement param,
                    java.lang.Class type,
                    java.util.Map extraNamespaces) throws org.apache.axis2.AxisFault{
                try {
                    if (com.itheima.elec.webservice.FindSystemByKeyword.class.equals(type)){
                        return com.itheima.elec.webservice.FindSystemByKeyword.Factory.parse(param.getXMLStreamReaderWithoutCaching());
                    }
                    if (com.itheima.elec.webservice.FindSystemByKeywordResponse.class.equals(type)){
                        return com.itheima.elec.webservice.FindSystemByKeywordResponse.Factory.parse(param.getXMLStreamReaderWithoutCaching());
                    }
                } catch (java.lang.Exception e) {
                    throw org.apache.axis2.AxisFault.makeFault(e);
                }
                return null;
            }
            private java.util.Map getEnvelopeNamespaces(org.apache.axiom.soap.SOAPEnvelope env){
                java.util.Map returnMap = new java.util.HashMap();
                java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces();
                while (namespaceIterator.hasNext()) {
                    org.apache.axiom.om.OMNamespace	ns=(org.apache.axiom.om.OMNamespace) namespaceIterator.next();
                    returnMap.put(ns.getPrefix(),ns.getNamespaceURI());
                }
                return returnMap;
            }
            private org.apache.axis2.AxisFault createAxisFault(java.lang.Exception e) {
                org.apache.axis2.AxisFault f;
                Throwable cause = e.getCause();
                if (cause != null) {
                    f = new org.apache.axis2.AxisFault(e.getMessage(), cause);
                } else {
                    f = new org.apache.axis2.AxisFault(e.getMessage());
                }
                return f;
            }
        }
package com.itheima.elec.web.action;
import java.io.PrintWriter;
import javax.annotation.Resource;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import com.itheima.elec.domain.ElecCommonMsg;
import com.itheima.elec.service.IElecCommonMsgService;
import com.itheima.elec.utils.ValueUtils;
        @SuppressWarnings("serial")
        @Controller("elecCommonMsgAction")
        @Scope(value="prototype")
        public class ElecCommonMsgAction extends BaseAction<ElecCommonMsg> {
            ElecCommonMsg elecCommonMsg = this.getModel();
            @Resource(name=IElecCommonMsgService.SERVICE_NAME)
            IElecCommonMsgService elecCommonMsgService;
            public String home(){
                ElecCommonMsg commonMsg = elecCommonMsgService.findCommonMsg();
                ValueUtils.putValueStack(commonMsg);
                return "home";
            }
            public String save(){
                for(int i=1;i<=150;i++){
                    elecCommonMsgService.saveCommonMsg(elecCommonMsg);
                    request.getSession().setAttribute("percent", (double)i/150*100);
                }
                request.getSession().removeAttribute("percent");
                return "save";
            }
            public String actingView(){
                ElecCommonMsg commonMsg = elecCommonMsgService.findCommonMsg();
                ValueUtils.putValueStack(commonMsg);
                return "actingView";
            }
            public String progressBar() throws Exception{
                Double percent = (Double) request.getSession().getAttribute("percent");
                String res = "";
                if(percent!=null){
                    int percentInt = (int) Math.rint(percent);
                    res = "<percent>" + percentInt + "</percent>";
                }
                else{
                    res = "<percent>" + 100 + "</percent>";
                }
                PrintWriter out = response.getWriter();
                response.setContentType("text/xml");
                response.setHeader("Cache-Control", "no-cache");
                out.println("<response>");
                out.println(res);
                out.println("</response>");
                out.close();
                return null;
            }
        }
package com.itheima.elec.web.form;
        public class MenuForm {
            private String name;
            private String password;
            public String getName() {
                return name;
            }
            public void setName(String name) {
                this.name = name;
            }
            public String getPassword() {
                return password;
            }
            public void setPassword(String password) {
                this.password = password;
            }
        }
package com.itheima.elec.action;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import com.itheima.elec.domain.ElecExportFields;
import com.itheima.elec.service.IElecExportFieldsService;
import com.itheima.elec.utils.ListUtils;
        @SuppressWarnings("serial")
        @Controller("elecExportFieldsAction")
        @Scope(value="prototype")
        public class ElecExportFieldsAction extends BaseAction<ElecExportFields> {
            ElecExportFields elecExportFields = this.getModel();
            @Resource(name=IElecExportFieldsService.SERVICE_NAME)
            IElecExportFieldsService elecExportFieldsService;
            public String setExportFields(){
                String belongTo = elecExportFields.getBelongTo();
                ElecExportFieldsexportFields=elecExportFieldsService.findExportFieldsByID(belongTo;
                Map<String, String> map = new LinkedHashMap<String, String>();
                Map<String, String> nomap = new LinkedHashMap<String, String>();
                List<String> zList = ListUtils.stringToList(exportFields.getExpNameList(),"#");
                List<String> eList = ListUtils.stringToList(exportFields.getExpFieldName(),"#");
                List<String>nozList=ListUtils.stringToList(exportFields.getNoExpNameList(),"#");
                List<String>noeList=ListUtils.stringToList(exportFields.getNoExpFieldName(),"#");
                if(zList!=null && zList.size()>0){
                    for(int i=0;i<zList.size();i++){
                        map.put(eList.get(i), zList.get(i));
                    }
                }
                if(nozList!=null && nozList.size()>0){
                    for(int i=0;i<nozList.size();i++){
                        nomap.put(noeList.get(i), nozList.get(i));
                    }
                }
                request.setAttribute("map", map);
                request.setAttribute("nomap", nomap);
                return "setExportFields";
            }
            public String saveSetExportExcel(){
                elecExportFieldsService.saveSetExportExcel(elecExportFields);
                return "close";
            }
        }
    }